package com.yanqu.road.server.logic.recharge;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.snowgarden.SnowGardenUserData;
import com.yanqu.road.entity.config.goods.MallInfo;
import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.entity.recharge.RechargeOrder;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.fund.ActivityFundModule;
import com.yanqu.road.server.gameplayer.module.activity.snowgarden.SnowGardenModule;
import com.yanqu.road.server.gameplayer.module.player.CurrencyModule;
import com.yanqu.road.server.manger.activity.snowgarden.SnowGardenMgr;
import com.yanqu.road.utils.property.PropertyHelper;

/**
 * 冰雪游园战令
 */
public class SnowGardenTokenRecharge extends BaseRecharge {

    public SnowGardenTokenRecharge(GamePlayer player, MallInfo mallInfo, ActivityInfo activityInfo) {
        super(player, mallInfo, activityInfo);
    }

    @Override
    protected boolean isRepeatedBuy(String orderNo)  {
        return player.getModule(ActivityFundModule.class).isBuy(mallInfo);
    }

    @Override
    protected void repeatedBuyLogic() {

    }

    @Override
    protected String addMall(String orderNo, RechargeOrder rechargeOrder) {
        player.getModule(CurrencyModule.class).addCurrency(PropertyHelper.parseStringToProperty(mallInfo.getReward()),
                eLogMoneyType.Recharge, eLogMoneyType.ReChargeGet);
//        player.getModule(SnowGardenModule.class).rechargeToken(mallInfo.getActivityId(), mallInfo);
        player.getModule(ActivityFundModule.class).buy(mallInfo);
        logger.info("订单: {}, 购买冰雪游园战令 商品: {}", orderNo, mallInfo.getMallId());
        return mallInfo.getReward();
    }
}
